#include "StompedReality/Core/Input/KeyboardInput.h"
#include "StompedReality/Core/Input/Keys.h"
#include <iostream>
namespace StompedReality
{
namespace Input
{
KeyboardInput::KeyboardInput( )
{
  for ( int i = 0; i < 128; ++i )
  {
    this->m_CurrentKeys[i] = 0;
    this->m_PrevKeys[i] = 0;
  }
}

KeyboardInput::~KeyboardInput( )
{
}

void KeyboardInput::UpdateKeys ( bool* keys )
{
  for ( int i = 0; i < 300; ++i )
  {
    this->m_PrevKeys[i] = this->m_CurrentKeys[i];
    this->m_CurrentKeys[i] = keys[i];

    //keys[i] = 0;
  }
}

bool KeyboardInput::IsKeyDown ( const int key )
{
  return this->m_CurrentKeys[key] && !this->m_PrevKeys[key];
}

bool KeyboardInput::IsKeyPressed ( const int key )
{
  return this->m_CurrentKeys[key];
}

bool KeyboardInput::IsKeyUp ( const int key )
{
  return !this->m_CurrentKeys[key] && this->m_PrevKeys[key];
}

}
}
